package com.project.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;

@RestController
public class UploadController {
    @RequestMapping("/upload")
    public String upload(@RequestParam("annex") MultipartFile mf) throws Exception {
        String fileName = mf.getOriginalFilename();
        fileName = System.currentTimeMillis() + fileName;
        mf.transferTo(new File("C:\\Users\\LiuT\\Desktop\\vaadin\\mailProject\\src\\main\\resources\\static\\annex/" + fileName));
        return fileName;
    }

}
